package com.jvm.coline.part4.dispatch;

/**
 * @author Coline
 * 动态分派
 */
public class DynamicDispatch {
    static abstract class Human{
        public abstract void sayHello();
    }

    static class Man extends Human{
        @Override
        public void sayHello() {
            System.out.println("Man say Hello");
        }
    }

    static class Woman extends Human{
        @Override
        public void sayHello() {
            System.out.println("Woman say Hello");
        }
    }

    public static void main(String[] arg0){
        Human human1 = new Man();
        Human human2 = new Woman();

        human1.sayHello();
        human2.sayHello();
    }
}
